{{- $slug := printf "%s/comments/%s" .Lang .File.UniqueID }}
{{- $sorting := default "asc" $.Site.Params.staticman.sorting }}
{{- $reCaptchaKey := default "" $.Site.Params.staticman.reCaptchaKey }}
{{- $requiredFields := default slice $.Site.Params.staticman.requiredFields }}
{{- $extraFields := default slice $.Site.Params.staticman.extraFields }}
<input name="slug" type="hidden" value="{{ $slug }}">
<input name="reply_to" type="hidden" value="">
<input name="root_id" type="hidden" value="">
<div class="row g-3 mb-2">
    <div class="col-12 col-md-4 mb-2">
        <div class="form-floating required">
            <input class="form-control form-control-sm" aria-label="{{ i18n "comments_name" }}" name="name" type="text" id="comment-name" required />
            <label for="languages-select">{{ i18n "comments_name" }}</label>
        </div>
    </div>
    <div class="col-12 col-md-4 mb-2 ms-auto">
        <div class="form-floating{{ if in $requiredFields "email" }} required{{ end }}">
            <input class="form-control form-control-sm" aria-label="{{ i18n "comments_email" }}" name="email" type="email" id="comment-email"
                {{ if in $requiredFields "email" }} required{{ end }}/>
            <label for="comment-email">{{ i18n "comments_email" }}</label>
        </div>
    </div>
    {{- if in $extraFields "url" }}
    <div class="col-12 col-md-4 mb-2">
        <div class="form-floating{{ if in $requiredFields "url" }} required{{ end }}">
            <input class="form-control form-control-sm" aria-label="{{ i18n "comments_url" }}" name="url" type="url" id="comment-url"
                {{ if in $requiredFields "url" }} required{{ end }}/>
            <label for="comment-url">{{ i18n "comments_url" }}</label>
        </div>
    </div>
    {{- end }}
    <div class="col-12 mb-2">
        <div class="form-floating required">
            <textarea class="form-control" aria-label="{{ i18n "comments_message" }}" name="message" id="comment-message" required></textarea>
            <label for="comment-message">{{ i18n "comments_message" }}</label>
        </div>
    </div>
</div>
<div class="text-end">
    {{- if $reCaptchaKey }}
        <input type="hidden" name="reCaptchaToken" value="" required>
        <div class="g-recaptcha mb-2"
            data-sitekey="{{ $reCaptchaKey }}"
            data-callback="captchaCallback"
            data-expired-callback="captchaExpired"
            data-error-callback="captchaError"
        ></div>
    {{- end }}
    <button class="btn btn-primary" type="submit"{{ if $reCaptchaKey }} disabled{{ end }}>{{ i18n "comments_submit" }}</button>
</div>
